home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / CheatPopUp.as < prev    next >
Text File  |  2013-04-24  |  3KB  |  69 lines

  1. class CheatPopUp extends PopUp
  2. {
  3.    static var nMAX_LENGTH_CODE = 22;
  4.    static var sCODE_CHARS_ALLOWED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 _!?.";
  5.    static var sSTATE_CHEAT_OUTFITS = "Outfits";
  6.    static var sSTATE_CHEAT_BADCODE = "BadCode";
  7.    static var sSTATE_CHEAT_EMPTY = "Empty";
  8.    function CheatPopUp(_mcRef)
  9.    {
  10.       super(_mcRef);
  11.    }
  12.    function doShow()
  13.    {
  14.       if(this.sState == PopUp.sSTATE_IDLE)
  15.       {
  16.          this.setState(PopUp.sSTATE_OPENING);
  17.          this.nCount = 0;
  18.          this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(CheatPopUp.sSTATE_CHEAT_EMPTY);
  19.       }
  20.    }
  21.    function doHide()
  22.    {
  23.       if(this.sState == PopUp.sSTATE_OPENED)
  24.       {
  25.          var _loc2_ = this.mcRef.mcState.mcPanel.mcResult._currentframe;
  26.          var _loc3_ = this.mcRef.mcState.mcPanel.txtCheat.text;
  27.          this.setState(PopUp.sSTATE_CLOSING);
  28.          this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(_loc2_);
  29.          this.mcRef.mcState.mcPanel.txtCheat.text = _loc3_;
  30.       }
  31.    }
  32.    function clickCancelButton()
  33.    {
  34.       Controller.getRef().playClickSound();
  35.       this.doHide();
  36.    }
  37.    function clickEnterButton()
  38.    {
  39.       Controller.getRef().playClickSound();
  40.       if(this.mcRef.mcState.mcPanel.txtCheat.text == LD.sCHEAT_CLOTHING)
  41.       {
  42.          this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(CheatPopUp.sSTATE_CHEAT_OUTFITS);
  43.          Main.getRef().setCheatClothes(true);
  44.       }
  45.       else
  46.       {
  47.          this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(CheatPopUp.sSTATE_CHEAT_BADCODE);
  48.       }
  49.       Selection.setFocus(this.mcRef.mcState.mcPanel.txtCheat);
  50.    }
  51.    function manageChange()
  52.    {
  53.       this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(CheatPopUp.sSTATE_CHEAT_EMPTY);
  54.    }
  55.    function initPopUp()
  56.    {
  57.       this.mcRef.mcState.mcPanel.btnCancel.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
  58.       this.mcRef.mcState.mcPanel.btnCancel.onRelease = Delegate.create(this,this.clickCancelButton);
  59.       this.mcRef.mcState.mcPanel.btnEnter.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
  60.       this.mcRef.mcState.mcPanel.btnEnter.onRelease = Delegate.create(this,this.clickEnterButton);
  61.       this.mcRef.mcState.mcPanel.txtCheat.tabIndex = 101;
  62.       this.mcRef.mcState.mcPanel.txtCheat.maxChars = CheatPopUp.nMAX_LENGTH_CODE;
  63.       this.mcRef.mcState.mcPanel.txtCheat.restrict = CheatPopUp.sCODE_CHARS_ALLOWED;
  64.       this.mcRef.mcState.mcPanel.txtCheat.onChanged = Delegate.create(this,this.manageChange);
  65.       Selection.setFocus(this.mcRef.mcState.mcPanel.txtCheat);
  66.       this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(CheatPopUp.sSTATE_CHEAT_EMPTY);
  67.    }
  68. }
  69.